<template>
  <div>
    <div class="home">
      <div class="headImg">
        <img :src="imageUrl" alt=""  v-if="this.info.headUrl"/>
        <img :src="require('@/assets/imgs/geren/info3.png')" alt="" v-else/>
      </div>
      <div class="name">{{ info.realName }}</div>
      <div class="phone">
        联系方式
        <div>{{ info.mobile }}</div>
      </div>
      <div class="apply">
        我的应用
        <div v-if="info.appList">
          <span v-for="(v, index) in info.appList" :key="index">{{
            v.appName
          }}</span>
        </div>
      </div>
      <div class="role">
        角色
        <div>{{ info.roleName }}</div>
      </div>
      <div class="edit">
        <div class="com" @click="toEdit">
          <div class="t">
            <img src="@/assets/imgs/setting/edit.png" alt="" />
          </div>
          <div class="b">编辑</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getToken, getUserInfo } from "@/utils/public";
export default {
  name: "gerenUserInfo",
  components: {},
  data() {
    return {
      imageUrl: "",
      info: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getToken,
    getUserInfo,

    toEdit() {
      this.$router.push({
        path: "/geren/userInfo/edit",
      });
    },
    getList() {
      this.$http.get("/sys/user/getUser").then((res) => {
        if (res.code === "0000") {
          this.info = res.data;
          if (this.info.headUrl) {
            this.imageUrl =
              window.location.origin +
              `/merchantApi/oss/view?id=${this.info.headUrl}`;
          }
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.home {
  display: flex;
  justify-content: start;
  position: relative;
  background: #fff;
  padding: 41px 53px 31px 53px;
  color: #666;
  margin-top: 20px;
  // height: 190px;
  border-radius: 10px;
  .headImg {
    width: 108px;
    height: 108px;
    border-radius: 17px;
    overflow: hidden;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .name {
    position: absolute;
    left: 200px;
    top: 41px;
    height: 33px;
    font-size: 24px;
    font-family: PingFangSC-Light, PingFang SC;
    font-weight: 300;
    color: #1d1c1c;
    line-height: 33px;
  }
  .phone {
    margin-top: 60px;
    margin-left: 39px;
    height: 20px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #7a8287;
    line-height: 20px;
    div {
      margin-top: 10px;
      height: 20px;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #1d1c1c;
      line-height: 20px;
    }
  }
  .apply {
    max-width: 23.5vw;
    margin-top: 60px;
    margin-left: 101px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #7a8287;
    div {
      margin-top: 10px;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #1d1c1c;

      span {
        text-align: center;
        padding: 2px 13px;
        width: 8.1vh;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        overflow: hidden;
        height: 24px;
        line-height: 24px;
        background: rgba(37, 181, 217, 0.1);
        border-radius: 2px;
        color: #25b5d9;
        margin-right: 10px;
        margin-bottom: 5px;
      }
    }
  }
  .role {
    margin-top: 60px;
    margin-left: 101px;
    height: 20px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #7a8287;
    line-height: 20px;

    div {
      margin-top: 10px;
      height: 20px;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #1d1c1c;
      line-height: 20px;
    }
  }
  .edit {
    position: absolute;
    right: 35px;
    top: 63px;
    .com {
      margin: 0 25px;
      cursor: pointer;

      .t {
        width: 36px;
        height: 36px;
        line-height: 45px;
        text-align: center;
        border-radius: 36px;
        background: #869daa;
      }
      .b {
        font-size: 14px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #4f595f;
        text-align: center;
        margin-top: 5px;
      }
    }
  }
}
</style>
